package J20241107_difference;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 二维数组差分
 * User: 王圆豪
 * Date: 2024-11-09
 * Time: 23:48
 */
public class Two_dimensional_difference {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] arr = new int[n + 1][n + 1];
        for (int i = 1; i < n + 1; i++) {
            for (int j = 1; j < n + 1; j++) {
                arr[i][j] = sc.nextInt();
            }
        }
        int x1 = sc.nextInt();
        int y1 = sc.nextInt();
        int x2 = sc.nextInt();
        int y2 = sc.nextInt();
        int c = sc.nextInt();

        arr[x1][y1] += c;
        arr[x2][y1] -= c;
        arr[x1][y2] -=c;
        arr[x2][y2] += c;
    }
}
